<script setup lang="ts">
import { listSelect } from '@/common/list-select'
import { markRaw } from 'vue'
import { badaCodeList } from './core'

const props = defineProps<{
  modelValue: string
}>()

const emit = defineEmits<{
  (e: 'update:modelValue', u: string): void
}>()

function selectAcType() {
  listSelect<string>({
    title: '选择BADA机型',
    icon: 'mas-icon-AircraftType',
    data: markRaw(badaCodeList),
    getItemName: (e) => e,
    callback: (e) => {
      if (e === props.modelValue) {
        return
      }
      emit('update:modelValue', e)
    }
  })
}
</script>
<template>
  <button class="button" @click="selectAcType">{{ modelValue }}</button>
</template>
